<?php
$data = array(
    'basic' => array(
        "text" => '<span>' . Yii::t('setting', 'site_setting') . '</span>', "expanded" => true, "classes" => "important",
        "children" => array(
            array('text' => CHtml::link(Yii::t('setting', 'site_setting_global'), array('setting/default'), array('target' => 'mask'))),
            array('text' => CHtml::link(Yii::t('setting', 'site_setting_locations'), array('locations/index'), array('target' => 'mask'))),
        )
    ),
    'productBrands' => array(
        "text" => '<span>' . Yii::t('setting', 'multi_level_categories_setting') . '</span>', "expanded" => true, "classes" => "important",
        "children" => $child_datas
    ),
    'utils' => array(
        "text" => '<span>' . Yii::t('setting', 'util_setting') . '</span>', "expanded" => true, "classes" => "important",
        "children" => array(
            array('text' => CHtml::link(Yii::t('setting', 'util_setting_datas_transfer'), array('utils/DatasTransfer'), array('target' => 'mask'))),
            array('text' => CHtml::link(Yii::t('setting', 'util_setting_dbbackup'), array('utils/DBBackup'), array('target' => 'mask'))),
            array('text' => CHtml::link(Yii::t('setting', 'util_setting_clear_cache'), array('utils/clearCache'), array('target' => 'mask'))),
        )
    ),
    'user' => array(
        "text" => '<span>' . Yii::t('setting', 'users_setting') . '</span>', "expanded" => true, "classes" => "important",
        "children" => array(
            array('text' => CHtml::link(Yii::t('setting', 'users_setting_lists'), array('users/index'), array('target' => 'mask'))),
            array('text' => CHtml::link(Yii::t('setting', 'users_setting_groups'), array('userGroups/index'), array('target' => 'mask'))),
            array('text' => CHtml::link(Yii::t('setting', 'users_setting_rbac'), array('/srbac/authitem/frontpage'), array('target' => 'mask'))),
        )
    )
);
$this->widget('CTreeView', array(
    'persist' => 'cookie', 'data' => $data, 'animated' => 'fast', 'htmlOptions' => array(
        'id' => 'treeview', 'class' => 'filetree treeview-famfamfam'
    )
));
?>
<script type="text/javascript">
    var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
    //extra height in px to add to iframe in FireFox 1.0+ browsers
    var FFextraHeight=getFFVersion>= 0.1 ? 16 : 0
    function dyniframesize(iframename) {
        var minHeight = 400;
        var pTar = null;
        if (document.getElementById){
            pTar = document.getElementById(iframename);
        } else{
            eval('pTar = ' + iframename + ';');
        }
        if (pTar && !window.opera){
            //begin resizing iframe
            pTar.style.display="block"
            if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight) {
                //ns6 syntax
                h = (parseInt(pTar.contentDocument.body.offsetHeight+FFextraHeight) < minHeight)
                    ? minHeight
                    : parseInt(pTar.contentDocument.body.offsetHeight+FFextraHeight);
                pTar.height = h;
            } else if (pTar.Document && pTar.Document.body.scrollHeight){
                //ie5+ syntax
//                alert(pTar.Document.body.scrollHeight);
                h = (parseInt(pTar.Document.body.scrollHeight) < minHeight)
                    ? minHeight
                    : parseInt(pTar.Document.body.scrollHeight);
                pTar.height = h;
            }
        }
    }
</script>
<script type="text/javascript">
    function adjuctContents() {
        h = document.documentElement.offsetHeight;
        alert(h);
        w = document.documentElement.offsetWidth;
        $("#contents").width(w - 159).height(h - 90);
        if ($.browser.version == '6.0') {
            $("#mask").width(w - 166).height(h - 104);
        } else {
            $("#mask").width(w - 160).height(h - 100);
        }
    }

    function fnAClick(item) {
        h = document.documentElement.offsetHeight;
//        $('#mask').height(h);
        m = $("#mask").get(0);
//        alert(item.href);
        $('#treeview a').removeClass('current');
        $(item).addClass('current');
        m.src = item.href;
//        alert(m.src);
    }
    $(function() {
//        if ($.browser.msie) {
//            adjuctContents();
//            $(window).resize(adjuctContents);
//        }
        $('#treeview a').bind('click', function() {
            fnAClick(this);
            return false;
        });
    });
</script>